package foundation.sequence_characteristics;

import java.util.Arrays;
import java.util.Scanner;

/**
 * 给出n个数，找出这n个数的最大值，最小值，和。
 */
public class Main {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] nums = new int[n];
        for (int i = 0; i < n; i++) {
            nums[i] = sc.nextInt();
        }
        Arrays.sort(nums);
        System.out.println(nums[n - 1]);
        System.out.println(nums[0]);
        System.out.println(Arrays.stream(nums).sum());
    }
}
